{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Splom plots\n",
    "\n",
    "Splom plots are scatterplot matrices in which each cell represents a pairwise scatterplot of the input sequences. A collection of n sequences results in n*n scatterplots of which the diagonal cells are bisectors through the origin"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "dotnet_interactive": {
     "language": "fsharp"
    },
    "vscode": {
     "languageId": "dotnet-interactive.fsharp"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><div></div><div></div><div><strong>Installed Packages</strong><ul><li><span>Deedle.Interactive, 3.0.0-beta.1</span></li><li><span>Plotly.NET.Interactive, 3.0.2</span></li></ul></div></div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "// Referencing Plotly.NET.Interactive extension\n",
    "#r \"nuget: Plotly.NET.Interactive, 3.0.2\"\n",
    "// Deedle is required for data handling\n",
    "#r \"nuget: Deedle.Interactive, 3.0.0-beta.1\"\n",
    "\n",
    "open Plotly.NET\n",
    "open Plotly.NET.StyleParam\n",
    "open Plotly.NET.LayoutObjects\n",
    "open Plotly.NET.TraceObjects\n",
    "open Deedle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "dotnet_interactive": {
     "language": "fsharp"
    },
    "vscode": {
     "languageId": "dotnet-interactive.fsharp"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\r\n",
       "<style scoped>,\r\n",
       "  .dataframe tbody tr th:only-of-type {\r\n",
       "    vertical-align: middle;\r\n",
       "  }\r\n",
       "  .dataframe tbody tr th {,\r\n",
       "    vertical-align: top\r\n",
       "  }\r\n",
       "  .dataframe thead th {\r\n",
       "    text-align: right;\r\n",
       "  }\r\n",
       "  .no-wrap {\r\n",
       "    white-space: nowrap;\r\n",
       "  }\r\n",
       "</style>\r\n",
       "<table border='1' class='dataframe'>\r\n",
       "<thead><th></th><th></th><th>sepal length</th><th>sepal width</th><th>petal length</th><th>petal width</th><th>class</th></thead><thead><th></th><th></th><th>(Decimal)</th><th>(Decimal)</th><th>(Decimal)</th><th>(Decimal)</th><th>(string)</th></thead>\r\n",
       "<tr><td><b>0</b></td><td class=\"no-wrap\">-></td><td>5.1</td><td>3.5</td><td>1.4</td><td>0.2</td><td>Iris-setosa</td></tr><tr><td><b>1</b></td><td class=\"no-wrap\">-></td><td>4.9</td><td>3.0</td><td>1.4</td><td>0.2</td><td>Iris-setosa</td></tr><tr><td><b>2</b></td><td class=\"no-wrap\">-></td><td>4.7</td><td>3.2</td><td>1.3</td><td>0.2</td><td>Iris-setosa</td></tr><tr><td><b>3</b></td><td class=\"no-wrap\">-></td><td>4.6</td><td>3.1</td><td>1.5</td><td>0.2</td><td>Iris-setosa</td></tr><tr><td><b>4</b></td><td class=\"no-wrap\">-></td><td>5.0</td><td>3.6</td><td>1.4</td><td>0.2</td><td>Iris-setosa</td></tr><tr><td><b>:</b></td><td class=\"no-wrap\"></td><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td></tr><tr><td><b>145</b></td><td class=\"no-wrap\">-></td><td>6.7</td><td>3.0</td><td>5.2</td><td>2.3</td><td>Iris-virginica</td></tr><tr><td><b>146</b></td><td class=\"no-wrap\">-></td><td>6.3</td><td>2.5</td><td>5.0</td><td>1.9</td><td>Iris-virginica</td></tr><tr><td><b>147</b></td><td class=\"no-wrap\">-></td><td>6.5</td><td>3.0</td><td>5.2</td><td>2.0</td><td>Iris-virginica</td></tr><tr><td><b>148</b></td><td class=\"no-wrap\">-></td><td>6.2</td><td>3.4</td><td>5.4</td><td>2.3</td><td>Iris-virginica</td></tr><tr><td><b>149</b></td><td class=\"no-wrap\">-></td><td>5.9</td><td>3.0</td><td>5.1</td><td>1.8</td><td>Iris-virginica</td></tr>\r\n",
       "</table>\r\n",
       "<p><b>150</b> rows x <b>5</b> columns</p><p><b>0</b> missing values</p>\r\n",
       "</div>\r\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "// read csv as data frame\n",
    "let data = Frame.ReadCsv(__SOURCE_DIRECTORY__ + @\"\\data\\iris-data.csv\")\n",
    "\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "dotnet_interactive": {
     "language": "fsharp"
    },
    "vscode": {
     "languageId": "dotnet-interactive.fsharp"
    }
   },
   "outputs": [],
   "source": [
    "// extract values as float sequences\n",
    "let sepalLengthData = data.[\"sepal length\"] |> Series.values\n",
    "let sepalWidthData  = data.[\"sepal width\"]  |> Series.values\n",
    "let petalLengthData = data.[\"petal length\"] |> Series.values\n",
    "let petalWidthData  = data.[\"petal width\"]  |> Series.values\n",
    "\n",
    "// a color scale value is defined for each species\n",
    "let colors = \n",
    "    data.GetColumn<string> \"class\" \n",
    "    |> Series.values\n",
    "    |> Seq.map (fun x ->\n",
    "        match x with\n",
    "        | \"Iris-setosa\" -> 0.\n",
    "        | \"Iris-versicolor\" -> 0.5\n",
    "        | _ -> 1.\n",
    "        )\n",
    "    |> Color.fromColorScaleValues"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "dotnet_interactive": {
     "language": "fsharp"
    },
    "vscode": {
     "languageId": "dotnet-interactive.fsharp"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div>\n",
       "    <div id=\"2d5f57dc-a26c-4a30-9b21-1fa6d68f6ff6\"><!-- Plotly chart will be drawn inside this DIV --></div>\r\n",
       "<script type=\"text/javascript\">\r\n",
       "\r\n",
       "            var renderPlotly_2d5f57dca26c4a309b211fa6d68f6ff6 = function() {\r\n",
       "            var fsharpPlotlyRequire = requirejs.config({context:'fsharp-plotly',paths:{plotly:'https://cdn.plot.ly/plotly-2.6.3.min'}}) || require;\r\n",
       "            fsharpPlotlyRequire(['plotly'], function(Plotly) {\r\n",
       "\r\n",
       "            var data = [{\"type\":\"splom\",\"dimensions\":[{\"label\":\"sepal length\",\"values\":[5.1,4.9,4.7,4.6,5.0,5.4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,1.0,1.0,1.0],\"colorscale\":\"Portland\"},\"diagonal\":{}}];\r\n",
       "            var layout = {\"width\":1000,\"height\":1000,\"template\":{\"layout\":{\"title\":{\"x\":0.05},\"font\":{\"color\":\"rgba(42, 63, 95, 1.0)\"},\"paper_bgcolor\":\"rgba(255, 255, 255, 1.0)\",\"plot_bgcolor\":\"rgba(229, 236, 246, 1.0)\",\"autotypenumbers\":\"strict\",\"colorscale\":{\"diverging\":[[0.0,\"#8e0152\"],[0.1,\"#c51b7d\"],[0.2,\"#de77ae\"],[0.3,\"#f1b6da\"],[0.4,\"#fde0ef\"],[0.5,\"#f7f7f7\"],[0.6,\"#e6f5d0\"],[0.7,\"#b8e186\"],[0.8,\"#7fbc41\"],[0.9,\"#4d9221\"],[1.0,\"#276419\"]],\"sequential\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"sequentialminus\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]},\"hovermode\":\"closest\",\"hoverlabel\":{\"align\":\"left\"},\"coloraxis\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}},\"geo\":{\"showland\":true,\"landcolor\":\"rgba(229, 236, 246, 1.0)\",\"showlakes\":true,\"lakecolor\":\"rgba(255, 255, 255, 1.0)\",\"subunitcolor\":\"rgba(255, 255, 255, 1.0)\",\"bgcolor\":\"rgba(255, 255, 255, 1.0)\"},\"mapbox\":{\"style\":\"light\"},\"polar\":{\"bgcolor\":\"rgba(229, 236, 246, 1.0)\",\"radialaxis\":{\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"ticks\":\"\"},\"angularaxis\":{\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"ticks\":\"\"}},\"scene\":{\"xaxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"gridwidth\":2.0,\"zerolinecolor\":\"rgba(255, 255, 255, 1.0)\",\"backgroundcolor\":\"rgba(229, 236, 246, 1.0)\",\"showbackground\":true},\"yaxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"gridwidth\":2.0,\"zerolinecolor\":\"rgba(255, 255, 255, 1.0)\",\"backgroundcolor\":\"rgba(229, 236, 246, 1.0)\",\"showbackground\":true},\"zaxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"gridwidth\":2.0,\"zerolinecolor\":\"rgba(255, 255, 255, 1.0)\",\"backgroundcolor\":\"rgba(229, 236, 246, 1.0)\",\"showbackground\":true}},\"ternary\":{\"aaxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\"},\"baxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\"},\"caxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\"},\"bgcolor\":\"rgba(229, 236, 246, 1.0)\"},\"xaxis\":{\"title\":{\"standoff\":15},\"ticks\":\"\",\"automargin\":true,\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"zerolinecolor\":\"rgba(255, 255, 255, 1.0)\",\"zerolinewidth\":2.0},\"yaxis\":{\"title\":{\"standoff\":15},\"ticks\":\"\",\"automargin\":true,\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"zerolinecolor\":\"rgba(255, 255, 255, 1.0)\",\"zerolinewidth\":2.0},\"annotationdefaults\":{\"arrowcolor\":\"#2a3f5f\",\"arrowhead\":0,\"arrowwidth\":1},\"shapedefaults\":{\"line\":{\"color\":\"rgba(42, 63, 95, 1.0)\"}},\"colorway\":[\"rgba(99, 110, 250, 1.0)\",\"rgba(239, 85, 59, 1.0)\",\"rgba(0, 204, 150, 1.0)\",\"rgba(171, 99, 250, 1.0)\",\"rgba(255, 161, 90, 1.0)\",\"rgba(25, 211, 243, 1.0)\",\"rgba(255, 102, 146, 1.0)\",\"rgba(182, 232, 128, 1.0)\",\"rgba(255, 151, 255, 1.0)\",\"rgba(254, 203, 82, 1.0)\"]},\"data\":{\"bar\":[{\"marker\":{\"line\":{\"color\":\"rgba(229, 236, 246, 1.0)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"error_x\":{\"color\":\"rgba(42, 63, 95, 1.0)\"},\"error_y\":{\"color\":\"rgba(42, 63, 95, 1.0)\"}}],\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"rgba(229, 236, 246, 1.0)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}}}],\"carpet\":[{\"aaxis\":{\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"endlinecolor\":\"rgba(42, 63, 95, 1.0)\",\"minorgridcolor\":\"rgba(255, 255, 255, 1.0)\",\"startlinecolor\":\"rgba(42, 63, 95, 1.0)\"},\"baxis\":{\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"endlinecolor\":\"rgba(42, 63, 95, 1.0)\",\"minorgridcolor\":\"rgba(255, 255, 255, 1.0)\",\"startlinecolor\":\"rgba(42, 63, 95, 1.0)\"}}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}}}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"pie\":[{\"automargin\":true}],\"scatter\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scatter3d\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}},\"line\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scattercarpet\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scattergeo\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scattergl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scattermapbox\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scatterpolar\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scatterpolargl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scatterternary\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"surface\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"table\":[{\"cells\":{\"fill\":{\"color\":\"rgba(235, 240, 248, 1.0)\"},\"line\":{\"color\":\"rgba(255, 255, 255, 1.0)\"}},\"header\":{\"fill\":{\"color\":\"rgba(200, 212, 227, 1.0)\"},\"line\":{\"color\":\"rgba(255, 255, 255, 1.0)\"}}}]}},\"hovermode\":\"closest\",\"dragmode\":\"select\",\"annotations\":[{\"x\":7.6,\"y\":7.6,\"bgcolor\":\"rgba(217, 144, 144, 1.0)\",\"bordercolor\":\"black\",\"borderpad\":4,\"text\":\"Iris setosa\"},{\"x\":5.4,\"y\":5.4,\"bgcolor\":\"rgba(242, 228, 159, 1.0)\",\"bordercolor\":\"black\",\"borderpad\":4,\"text\":\"Iris versicolor\"},{\"x\":4.7,\"y\":4.7,\"bgcolor\":\"rgba(119, 152, 219, 1.0)\",\"bordercolor\":\"black\",\"borderpad\":4,\"text\":\"Iris virginica\"}]};\r\n",
       "            var config = {\"responsive\":true,\"toImageButtonOptions\":{\"format\":\"svg\"}};\r\n",
       "            Plotly.newPlot('2d5f57dc-a26c-4a30-9b21-1fa6d68f6ff6', data, layout, config);\r\n",
       "});\r\n",
       "            };\r\n",
       "            if ((typeof(requirejs) !==  typeof(Function)) || (typeof(requirejs.config) !== typeof(Function))) {\r\n",
       "                var script = document.createElement(\"script\");\r\n",
       "                script.setAttribute(\"src\", \"https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js\");\r\n",
       "                script.onload = function(){\r\n",
       "                    renderPlotly_2d5f57dca26c4a309b211fa6d68f6ff6();\r\n",
       "                };\r\n",
       "                document.getElementsByTagName(\"head\")[0].appendChild(script);\r\n",
       "            }\r\n",
       "            else {\r\n",
       "                renderPlotly_2d5f57dca26c4a309b211fa6d68f6ff6();\r\n",
       "            }\r\n",
       "</script>\r\n",
       "\n",
       "    \n",
       "</div>    \n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "let splomChart = \n",
    "    Chart.Splom(\n",
    "        // input is a sequence of <identifier*values>\n",
    "        [\n",
    "            \"sepal length\" , sepalLengthData\n",
    "            \"sepal width\"  , sepalWidthData\n",
    "            \"petal length\" , petalLengthData\n",
    "            \"petal width\"  , petalWidthData\n",
    "        ],\n",
    "        MarkerColor = colors,\n",
    "        MarkerColorScale=StyleParam.Colorscale.Portland\n",
    "    )\n",
    "    |> Chart.withLayout(\n",
    "        Layout.init(\n",
    "            // hover info is shown just for closest data point\n",
    "            HoverMode = StyleParam.HoverMode.Closest,\n",
    "            // if a region is selected, data points within the selection are highlighted\n",
    "            DragMode = StyleParam.DragMode.Select\n",
    "        )\n",
    "    )\n",
    "    |> Chart.withSize (1000,1000)\n",
    "    // alters the \"Download plot\" button to export the plot as SVG \n",
    "    |> Chart.withConfig(Config.init(ToImageButtonOptions = ConfigObjects.ToImageButtonOptions.init(Format=ImageFormat.SVG)))\n",
    "    //|> Chart.withTitle(Title.init(\"Splom plot of iris data set\",X=0.5))\n",
    "let setosaAnnotation = Annotation.init(Text=\"Iris setosa\",X=7.6,Y=7.6,BGColor= Color.fromHex \"#D99090\",BorderColor= Color.fromString \"black\", BorderPad=4)\n",
    "let versicolorAnnotation = Annotation.init(Text=\"Iris versicolor\",X=5.4,Y=5.4,BGColor= Color.fromHex \"#F2E49F\",BorderColor= Color.fromString \"black\", BorderPad=4)\n",
    "let virginicaAnnotation = Annotation.init(Text=\"Iris virginica\",X=4.7,Y=4.7,BGColor= Color.fromHex \"#7798DB\",BorderColor= Color.fromString \"black\", BorderPad=4)\n",
    "\n",
    "splomChart\n",
    "|> Chart.withAnnotations [setosaAnnotation;versicolorAnnotation;virginicaAnnotation]"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".NET (F#)",
   "language": "F#",
   "name": ".net-fsharp"
  },
  "language_info": {
   "name": "F#"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
